<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断是否为闰年</title>
</head>
<body>
    <script>
    var n = parseInt(prompt('请输入一个年份'))
    if(isNaN(n)){
        alert('请输入正确的年份')
    }
    else{
        alert(year(n));
    }
    function year(n){
        if(n % 4 == 0 && n% 100 != 0|| n % 400 == 0){
            return '输入的年份为闰年';
        }else{
            return '输入的年份为平年';
        }
    }
    </script>
</body>
</html>